import Login from "@/views/Login";
import Home from "@/views/Home";

/**
 * 动态路由
 * @type {{sysRole: (function(): Promise<*>), sysUser: (function(): Promise<*>), sysMenu: (function(): Promise<*>)}}
 */
export const dynamicRouters = {
    dashboard: () => import(`@/views/dashboard/index.vue`),
    sysUser: () => import(`@/views/sys/user/index.vue`),
    sysMenu: () => import(`@/views/sys/menu/index.vue`),
    sysRole: () => import(`@/views/sys/role/index.vue`)
}

/**
 * 公共路由
 * @type {[{redirect: string, path: string},{path: string, component: {}, name: string},{path: string, component: {}, children: [{path: string, component: (function(): Promise<*>), name: string}], name: string}]}
 */
export const commonRouters = [
    {
        path: '/',
        redirect: '/home',
    },
    {
        path: '/login',
        name: 'Login',
        component: Login
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        children: [
            {
                path: '/dashboard',
                name: 'Dashboard',
                component: dynamicRouters['dashboard']
            }
        ]
    }
]

